#ifndef TITLEBAR_H
#define TITLEBAR_H

#include <QWidget>
#include"mypushbutton.h"
#include<QLabel>
#include<QMouseEvent>
#include<QToolButton>
#include<QLineEdit>
#include<QAction>
#include <QMouseEvent>

class TitleBar : public QWidget
{
    Q_OBJECT
public:
    explicit TitleBar(QWidget *parent = 0);
    ~TitleBar();


private:
    MyPushButton *minBtn,*closeBtn;
    MyPushButton*minBtn2,*menuBtn;
    QLabel *iconLabel,*textLabel;

protected:
    bool eventFilter(QObject *watched, QEvent *event) override;
    void paintEvent(QPaintEvent *event) override;

    void mousePressEvent(QMouseEvent *e) override;           // 鼠标点击事件
    void mouseMoveEvent(QMouseEvent *e) override;            // 鼠标移动事件
    void mouseDoubleClickEvent(QMouseEvent *e) override;     // 鼠标双击事件

signals:
    void ClickedMenuBtn();

public slots:
    void onClicked();


private:
    void showMaxRestore();

private:
    QPoint m_StartPos;      // 记录窗口开始的位置
    QPoint m_ClickPos;
    bool m_MaxNormal;
};

#endif // TITLEBAR_H
